﻿using System;
using System.Linq;
using System.Web.UI.WebControls;
using Ones.ServiceHumanResourceManagement;

namespace Ones.SysAdmin
{
    public partial class HrListEmpPage : System.Web.UI.Page
    {
        private ServiceHumanResourceManagementClient c = null;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                loadEmp();
            }
        }

        public void rpt_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            Session.Add("cmd", e.CommandName);
            Session.Add("id", e.CommandArgument);

            if (e.CommandName.ToString().Equals("detail"))
            {
                Response.Redirect("~/SysAdmin/HrDetailEmpPage.aspx");
            }
            Response.Redirect("~/SysAdmin/HrMgmtEmpPage.aspx");
        }

        private void loadEmp()
        {
            c = new ServiceHumanResourceManagementClient("hrBasicHttpBinding");

            rpt.DataSource = c.searchAllEmployees();
            rpt.DataBind();

            c.Close();
        }
    }
}